/**
 * application's router file
 *
 * @summary short description for the file
 * @author Lucky
 *
 * Created at     : 2019-04-15 13:11:30 
 * Last modified  : 2019-04-30 21:42:27
 */


import Vue from 'vue'
import Router from 'vue-router'
import HomePage from '../views/homepage/homepage.vue'
import Step from '../views/step'
import EstimateScore from '../views/step/estimatescore'
import ChooseArea from '../views/step/choosearea'
import ChooseProfession from '../views/step/chooseprofession'
import PaymentRecord from '../views/paymentrecord'
import HistoryRecord from '../views/historyrecord'
import HelpCenter from '../views/helpcenter'
import RecommendReason from '../views/recommendreason'
import ColleageRecommend from '../views/colleagerecommend'
import EstimateColleage from '../views/estimatecolleage'
import Profile from '../views/profile'
import EstimateRecord from '../views/estimaterecord'
import WxPay from '../views/wxpay'
import PayReturnMsg from '../views/payReturnMsg'
import Result from '../views/result'
import Layout from '../views/layout'
Vue.use(Router)

const router = new Router({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'layout',
      component: Layout,
      children: [
        {
          path: '',
          component: HomePage,
        },
      ]
    },
    {
      path: '/step',
      component: Step,
      children: [
        {
          path: 'estimatescore',
          component: EstimateScore,
          // meta: {
          //   requireAuth: true
          // }
        },
        {
          path: 'choosearea',
          component: ChooseArea,
          // meta: {
          //   requireAuth: true
          // }
        },
        {
          path: 'chooseprofession',
          component: ChooseProfession,
          // meta: {
          //   requireAuth: true
          // }
        }
      ]
    },
    {
      path: '/result',
      component: Result
    },
    {
      path: '/paymentrecord',
      component: PaymentRecord
    },
    {
      path: '/historyrecord',
      component: HistoryRecord
    },
    {
      path: '/helpcenter',
      component: HelpCenter
    },
    {
      path: '/recommendreason',
      name: 'recommendreason',
      component: RecommendReason
    },
    {
      path: '/colleagerecommend',
      name: 'colleagerecommend',
      component: ColleageRecommend
    },
    {
      path: '/estimatecolleage',
      name: 'estimatecolleage',
      component: EstimateColleage
    },
    {
      path: '/profile',
      name: 'profile',
      component: Profile
    },
    {
      path: '/estimaterecord',
      name: 'estimaterecord',
      component: EstimateRecord
    },
    {
      path: '/wxpay',
      name: 'wxpay',
      component: WxPay
    },
    {
      path: '/payreturnmsg',
      name: 'payreturnmsg',
      component: PayReturnMsg
    }
  ]
})

// router.beforeEach((to, from, next) => {
//   if (to.meta.requireAuth) {
//     if (localStorage.getItem('user')) {
//       next()
//     } else {
//       next({
//         path: '/',
//         query: {redirect: to.fullPath}
//       })
//     }
//   } else {
//     next()
//   }
// })

export default router